package com.neighbor.neighborhooduser.pojo;

public enum OrderStatus {
    PENDING_CONFIRMATION(1, "待确认"),
    IN_PROGRESS(2, "进行中"),
    COMPLETED(3, "已完成"),
    CANCELLED(4, "已取消");

    private final byte value;
    private final String description;

    OrderStatus(int value, String description) {
        this.value = (byte) value;
        this.description = description;
    }

    public byte getValue() {
        return value;
    }

    public String getDescription() {
        return description;
    }

    public static OrderStatus fromValue(byte value) {
        for (OrderStatus status : OrderStatus.values()) {
            if (status.value == value) {
                return status;
            }
        }
        throw new IllegalArgumentException("无效的订单状态值: " + value);
    }
}